package com.joker.yuwu;

import com.joker.repository.CreatLogin;
import com.joker.repository.SearchLogin;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

//创建账号；注册账号
@WebServlet("/creatuse")
public class CreatUse extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        super.doGet(req, resp);
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        String usename=req.getParameter("UserName");
        String password=req.getParameter("PassWord");

        CreatLogin s1=new CreatLogin();
        System.out.println("输出账号密码"+usename+password);
        if(s1.Show(usename,password)){
            System.out.println("创建用户成功");
            resp.getWriter().write("true");
        }
        else {
            System.out.println("登录失败");
            resp.getWriter().write("false");
        }
    }
}
